<?php
/*
 * @Author: lokei
 * @Date: 2022-12-30 17:28:40
 * @LastEditors: lokei
 * @LastEditTime: 2022-12-31 17:54:31
 * @Description: 
 */
namespace App\Http\Controllers\Widget;

use App\Common\Tools\ResultTool;
use App\Http\Controllers\Controller;
use App\Models\Widget\ThemeActivityModel;
use Illuminate\Http\Request;

class ActivityController extends Controller {
    
    public function getList() {
        $theme = ThemeActivityModel::first();
        if(is_null($theme)) {
            $theme = new ThemeActivityModel();
            $theme->save();
        }
        $res = ResultTool::success();
        $res['data'] = [
            'list_theme' => $theme->list_theme,
            'client_release_on' => $theme->client_release_on
        ];
        return $res;
    }

    public function updateList(Request $request) {
        $theme = ThemeActivityModel::first();
        $theme->list_theme = $request->input('list_theme');
        $theme->client_release_on = $request->input('client_release_on');
        $theme->save();
        return ResultTool::success();
    }

}